package com.itcast.springboot.mapper;

import com.itcast.springboot.bean.Friend;
import com.itcast.springboot.bean.User;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface FriendMapper {
    //增
    public Integer insertFriend(Friend friend);

    //删
    public Integer deleteFriend(Integer fid);

    //取消关注：通过用户id和好友id删除friend表对应信息
    public Integer deleteFriendByUidAndFid(@Param("userId") String uid, @Param("friendId") String friendId);

    //查
    public Friend getFriendById(Integer fid);

    //通过id查询对应好友的id和姓名
    public List<Friend> getFriendsAndNames(String uid);

    //根据uid和fids判断是否为好友：取判断
    public List<String> isFriendsByUids(@Param("uid") String uid, @Param("friendids") List<String> fids);

    //根据uid和fids判断是否为好友：取fids
    public List<String> existFidsByUids(@Param("uid") String uid, @Param("friendids") List<String> fids);

    //多个count查询：多个好友id查询被加为好友的次数
    public List<Integer> getCountsByfids(@Param("friendIds") List<String> fids);

    //判断某个用户是否存在某个好友
    public Integer getExistFriend(@Param("userId") String uid, @Param("friendId") String fid);

    //改
    public Integer updateFriend(Friend friend);
}
